/*******************************************************************
 * @Warning      : Without permission from the author,Not for commercial use
 * @File         :
 * @Author       : xiaowine
 * @Date         : 2020-09-02 10:33:07
 * @version      : v01.00
 * @ **************************************************************
 * @LastEditTime : 2020-09-02 11:14:22
 * @LastEditors  : xiaowine
 * @ **************************************************************
 * @brief        :
 * @Description  :
 * @FilePath     : \T5L_C51_PRJ\FUNC_HANDLER\control.h
 * @ **************************************************************
 * @attention    :
 * @Powered By xiaowine
 * @<h2><center>&copy;  Copyright(C) cee0.com 2020</center></h2>
 * @All rights reserved
 ******************************************************************/
#ifndef __CONTROL_H_
#define __CONTROL_H_
#include "sys.h"

typedef struct _timer_period
{
    u16 timer_time_start;
    u16 timer_time_end;
    u16 timer_speed;
    u16 timer_switch;
} timer_period;

#define TOUCH_EVENT_FLAG 0x2004
#define AT_HOME_EVENT 0XEE00
#define LEAVE_HOME_EVENT 0XEE01

//温控器状态
extern u16 TC_Status;
extern u16 TC_Status_Old;

extern timer_period tim_per_val[3][4];
extern u16 tim_week_c[3];
extern u16 timer_week[3][7];

void System_Parm_Init(void);
void Control_Function(void);
void Timer_Config_Handler(void);
u8 Alarm_Handler(void);

void Read_Nor_Flash(void);
void Write_Nor_Flash(void);
void Parm_Reset_Init(void);

void touchHandler(void);
void controlSwitch(void);
void atHomeEventHandl(void);
void leaveHomeEventHandl(void);

#endif
